<template>
  <div>
        
    <!-- 推荐歌单 -->
    <div class="remLists">
      <div class="title"><span>推荐歌单</span></div>
      <div class="content">
        <ul>
          <!-- <li v-for="item in Personalizedr" :key="item.id" @click="getid(item.id)"> -->
            <router-link v-for="item in Personalizedr" :key="item.id" tag="li" :to="'/songlists?id='+item.id">
              <div class="img">
                <van-image lazy-load
                  :src="item.picUrl"
                />
              </div>
              <p>{{item.name}}</p>
              <span><i class="iconfont icon-erji"></i>{{ item.playCount | playCountData }}</span>
            </router-link>
          <!-- </li> -->
        </ul>
      </div>
    </div>

    

  </div>
</template>

<script>
import Swiper from 'swiper';

export default {
  props:['Personalizedr'],
  methods:{
    getid(id){
      // console.log(id)
      this.$emit("getslID",id)
    },
  },
  filters:{
    playCountData(value){
      let w = value > 10000? value / 10000 : value; // 万计算
      let y = w > 10000? parseInt(w/10000)+"亿": parseInt(w) + "万";//亿计算
      return y;
    }
  },
  mounted(){
  new Swiper('.swiperA', {
      pagination: '.swiper-pagination',
      slidesPerView: 'auto',  //显示个数
      paginationClickable: false,// 指示点点击
      observer:true,
      observeParents:false,
      freeMode: false, // 不自动贴合模式
    });
  },
}
</script>

<style lang="less">
  .remLists {
      .title {
        height: 60px;
        line-height: 60px;
        text-indent: 5px;
        font-size: 16px;
        color: #000;
        font-weight: bold;
        
      }
      .content {
        ul {
          display: flex;
          flex-wrap: wrap;
          justify-content: left;
          padding-left: 1px;
          li {
            flex: 0 0 32%;
            position: relative;
            margin: 0px 2px;
            span {
              position: absolute;
              top: 0px;
              right: 0px;
              color: #fff;
              font-size: 10px;
              i {
                font-size: 15px;
                vertical-align: middle;
              }
            }
            .img {
              min-height: 50px;
              width: 100%;
              border-radius: 3px;
              img {
                width: 100%;
                border-radius: 3px;
              }
            }
            p {
              font-size: 12px;
              color: #565658;
              line-height: 15px;
              padding: 5px;
              margin-bottom: 10px;
              height: 26px;
              overflow: hidden;
            }
          }
        }
      }
      .resongs{
      .resongsTitle {
        height: 60px;
        line-height: 60px;
        text-indent: 5px;
        font-size: 16px;
        color: #000;
        display: flex;
        justify-content: space-between;
        .rsTitle{
          font-weight: bold;
        }
        .more{
          font-size: 13px;
          color: #999;
          margin-right: 5px;
          .arright{
            font-size: 12px;
          }
        }
      }
      ul{
        list-style: none;
        li{
          width: 96%;
          margin: 0px auto;
          padding: 10px 0px;
          display: flex;
          align-items: center;
          justify-content: space-between;
          border-bottom: 1px solid #ccc;
          .resongsImg{
            background-color: pink;
            width: 60px;
            height: 60px;
            border-radius: 4px;
            overflow: hidden;
            img{
              width: 100%;
              height: 100%;
            }
          }
          .resongsText{
            flex: 4;
            padding-left: 10px;
            h4{
              width: 240px;
              font-weight: 700;
              display: inline-block;
              overflow: hidden;
              text-overflow: ellipsis;
              white-space: nowrap;
            }
            p{
              width: 240px;
              font-size: 14px;
              overflow: hidden;
              text-overflow: ellipsis;
              white-space: nowrap;
              color: #999;
              overflow: hidden;
            }
          }
          .bofang{
            border-radius: 50%;
            width: 30px;
            height: 30px;
            line-height: 30px;
            text-align: center;
            .bf{
              font-size: 16px;
              margin-left: 3px;
              color: #ccc;
            }
          }
        }
      }
    }
  }
  div.swiperA{
      overflow: hidden;
      text-align: left;
      .resongsTitle {
        height: 60px;
        line-height: 60px;
        text-indent: 5px;
        font-size: 16px;
        color: #000;
        display: flex;
        justify-content: space-between;
        .rsTitle{
          font-weight: bold;
        }
        .more{
          font-size: 13px;
          color: #999;
          margin-right: 5px;
          .arright{
            font-size: 12px;
          }
        }
      }
      div.swiper-wrapper{
        div.swiper-slide{
          background-color: white;
          overflow: hidden;
          div.item{
            width: 96%;
            margin: 0px auto;
            padding: 10px 0px;
            display: flex;
            align-items: center;
            justify-content: space-between;
            border-bottom: 1px solid #ccc;
            .resongsImg{
              background-color: pink;
              width: 60px;
              height: 60px;
              border-radius: 4px;
              overflow: hidden;
              img{
                width: 100%;
                height: 100%;
              }
            }
            .resongsText{
              flex: 4;
              padding-left: 10px;
              h4{
                width: 240px;
                font-weight: 700;
                display: inline-block;
                overflow: hidden;
                text-overflow: ellipsis;
                white-space: nowrap;
              }
              p{
                width: 240px;
                font-size: 14px;
                overflow: hidden;
                text-overflow: ellipsis;
                white-space: nowrap;
                color: #999;
                overflow: hidden;
              }
            }
            .bofang{
              border-radius: 50%;
              width: 30px;
              height: 30px;
              line-height: 30px;
              text-align: center;
              .bf{
                font-size: 16px;
                margin-left: 3px;
                color: #ccc;
              }
            }
          }
        }
      }
  }
</style>
